import Immutable from 'immutable';

const defaultState = new Immutable.List();

// console.log("defaultState ==>", defaultState)

export default function userReducer(state = defaultState, action) {
  switch(action.type) {
    case 'CREATE_USER':
      return state.concat(action.text);
    case 'EDIT_USER':
      return state.set(action.id, action.text);
    case 'DELETE_USER':
      return state.delete(action.id);
    case 'LOAD_USERS':
      return action.data.data;
    default:
      return state;
  }
}
